^notice $0 [ERROR] Command is !wager <amount> where amount more than 0 but less than your score.
}
{
if (trivia.temp == 1) {
^notice $0 You have chosen to wager5 $trivia.temp point.
}
{
^notice $0 You have chosen to wager5 $trivia.temp points.
}
# This is a validated wager, so go ahead and place it (exits function).
$putwager($0 $trivia.temp)
}
}
# Determine whether they are messaging a valid command. If so, go to command parsing.
# Otherwise, go to message parsing.
if (match($word(0 $1-) $trivia.VALIDCMD))
{
# !title, !title_kill are used for the personal stat system.
if (word(0 $1-) == [!title]) {
@trivia.tempnet = trivia[SCORE][$encode($0)]
if (trivia.tempnet < trivia.MAXRANK) {
^notice $0 [ERROR] Sorry, but your rank is not high enough to use this command.
}
{
if (!word(1 $1-)) {
^notice $0 [ERROR] Command is !title <new title>.
}
{
^timer 1 /change_title $0 $2-
}
}
}
if (word(0 $1-) == [!title_kill]) {
if (trivia[SELF_TITLE][$encode($0)] != []) {
^assign -trivia[SELF_TITLE][$encode($0)]
^notice $0 Your customized title has been successfully removed.
}
{
^notice $0 [ERROR] Sorry, but you do not have a customized title to delete.
}
}
if (word(0 $1-) == [!start]) {
^timer 1 /trivia
}
# !stop, !reset, !add, !sub, !wipe are admin cmds which require the
# admin password. Do not put non-admin commands below here because the admin password is
# checked at this point. Normal commands will fail.
if (!match($word(0 $1-) $trivia.VALIDADMINCMD)) {
# Don't do anything since this is not an admin command.
}
{
if (word(1 $1-) != trivia.ADMINPASS) {
^notice $0 [ERROR] The admin password you provided is not correct.
}
{
$parse_admin($0 $1-)
}
}
}
{
if (word(0 $1-) == [!help]) {
if (word(1 $1-) == [copyright]) {
^notice $0 The full content of this script as well auxilary support files are copyrights of Bernard Yen. You are allowed to modify and distribute the script on a non-profit basis, but changes must be clearly stated and not misrepresented as the original.
}
if (word(1 $1-) == [general]) {
^notice $0 There are $trivia.MAXROUND rounds every game, followed by a wagering round where you can potentially double your score. Points are allocated as $trivia.P.1, $trivia.P.2, $trivia.P.3, and $trivia.P.4 respectively for the $trivia.MAXROUND rounds. Approximately 2 questions per game are daily double questions that carry greater award. To answer, simply type the answer in the channel.
}
if (word(1 $1-) == [start_game]) {
^notice $0 You can start a game of trivia at any time by typing !trivia start into the trivia channel, but please note that only an admin can stop the game while it is in progress.
}
# Special features help system
if (word(1 $1-) == [daily_double]) {
^notice $0 Every game, there are approximately 2 questions that will have "daily double" after them. Getting those correct will give you double the normal points, but getting them incorrect will cause you to lose half of what the round is worth. If the round is normally worth 2 points, you could potentially gain 4 points or lose 2 points per guess.
}
# Stat commands help system
if (word(1 $1-) == [title]) {
^notice $0 By typing /msg $N !title <title> after you reach a rank of at least $trivia.MAXRANK, you will be able to create a customized title for your personal stat database display.
}
if (word(1 $1-) == [title_kill]) {
^notice $0 By typing /msg $N !title_kill you can delete your customized title.
}
# Admin control help system
if (word(1 $1-) == [add]) {
^notice $0 By typing /msg $N !add <adm_pass> <nick> <pts> you can add points to a specified player.
}
if (word(1 $1-) == [reset]) {
^notice $0 By typing /msg $N !reset <adm_pass> you can reset the used question list.
}
if (word(1 $1-) == [save]){
^notice $0 By typing /msg $N !save <adm_pass> you can save trivia variables to the file. Please note that this is currently buggy and may cause unexpected crashes.
}
if (word(1 $1-) == [start]) {
^notice $0 By typing !start in the channel you can start a game of trivia if it is stopped.
}
if (word(1 $1-) == [stop]) {
^notice $0 By typing /msg $N !stop <adm_pass> you can stop a game of trivia.
}
if (word(1 $1-) == [sub]) {
^notice $0 By typing /msg $N !sub <adm_pass> <nick> <pts> you can subtract points from a specified player.
}
if (word(1 $1-) == [wipe]) {
^notice $0 By typing /msg $N !wipe <adm_pass> <nick> where nick is a case sensitive nickname, you can wipe the personal stat database of the specified player.
}
}
{
# is this a valid answer
$compare($0 $1-)
}
}
}
# Changes the title of an individual player. This function is assumed only accessible after a
# player achieves the minimum rank of trivia.MAXRANK.
alias change_title {
^assign trivia[SELF_TITLE][$encode($0)] $1-
^notice $0 Your title has been successfully changed.
}
# Handles the parsing of admin commands. This function assumes that when it is being called, the
# admin password has already been verified.
alias parse_admin {
if (word(0 $1-) == [!stop]) {
/endtrivia
}
if (word(0 $1-) == [!reset]) {
^timer 1 /reset_used $0
}
if (word(0 $1-) == [!wipe]) {
if (!word(2 $1-)) {
^notice $0 [ERROR] Command is !wipe <admin password> <nick>.
}
{
^timer 1 /wipe_stat $0 $word(2 $1-)
}
}
if (word(0 $1-) == [!save]) {
/sve
^notice $0 The current game stats have been saved.
}
if (word(0 $1-) == [!add]) {
if (!word(2 $1-) || !word(3 $1-)) {
^notice $0 [ERROR] Command is !add <password> <nick> <amt>.